package bom.example.common.config;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @author X.I.O
 * @title: SystemInitConfig
 * @projectName springboot
 * @description: TODO
 * @date 2021/10/26 15:24
 *
 * 系统初始化配置
 */
@Configuration
public class SystemInitConfig {

    @Bean("cache")
    public Cache createLocalCache(){
        Cache<String, Object> manualCache = Caffeine.newBuilder()
                .expireAfterWrite(30, TimeUnit.MINUTES)
                .maximumSize(10_000)
                .build();
        return manualCache;
    }


}
